﻿//
// Created by QU on 24-9-30.
//

#ifndef LOGICNODEPROCESSOR_H
#define LOGICNODEPROCESSOR_H

#include <iostream>
#include <memory>

#include "node/Node.h"
#include "server/logic/LogicSystem.h"
#include "server/server/NodeProcessor.h"
#include "server/server/Session.h"
#include "server/logic/LogicNode.h"

class NodeProcessor;
class LogicNode;

class LogicNodeProcessor final : public NodeProcessor
{
public:
    void operator()(std::shared_ptr<Session> session, std::shared_ptr<Node> node) override
    {
        {
            std::printf("LogicNodeProcessor::operator() impl...\n");
            std::cout << session->getUuid() << ": " << node.get() << std::endl;

            auto logic_node = std::make_shared<LogicNode>(session, node);
            LogicSystem::getInstance()->postNodeToQueue(logic_node);
        }
    }
};
#endif //LOGICNODEPROCESSOR_H
